import { createRouter, createWebHistory } from 'vue-router'
import UserLoginPage from "@/Pages/UserLoginPage.vue";
import HomePage from "@/Pages/HomePage.vue";
import UserRegisterPage from "@/Pages/UserRegisterPage.vue";
import UserManagePage from "@/Pages/UserManagePage.vue";
import AddPicturePage from '@/Pages/AddPicturePage.vue'
import PictureManagePage from '@/Pages/PictureManagePage.vue'
import PictureDetailPage from '@/Pages/PictureDetailPage.vue'
import AddPictureBatchPage from '@/Pages/AddPictureBatchPage.vue'
import SpaceManagePage from '@/Pages/SpaceManagePage.vue'
import AddSpacePage from '@/Pages/AddSpacePage.vue'
import MySpacePage from '@/Pages/MySpacePage.vue'
import SpaceDetailPage from '@/Pages/SpaceDetailPage.vue'
import SearchPicturePage from '@/Pages/SearchPicturePage.vue'

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: '/',
      name: 'home',
      component: HomePage,
    },
    {
      path: '/user/login',
      name: '用户登录',
      component: UserLoginPage,
    },
    {
      path: '/user/register',
      name: '用户注册',
      component: UserRegisterPage,
    },
    {
      path: '/admin/userManage',
      name: '用户管理',
      component: UserManagePage,
    },
    {
      path: '/add_picture',
      name: '创建图片',
      component: AddPicturePage,
    },
    {
      path: '/add_space',
      name: '创建空间',
      component: AddSpacePage,
    },
    {
      path: '/admin/pictureManage',
      name: '图片管理',
      component: PictureManagePage,
    },
    {
      path: '/add_picture/batch',
      name: '批量创建图片',
      component: AddPictureBatchPage,
    },
    {
      path: '/admin/spaceManage',
      name: '空间管理',
      component: SpaceManagePage,
    },
    {
      path: '/my_space',
      name: '我的空间',
      component: MySpacePage,
    },
    {
      path: '/space/:id',
      name: '空间详情',
      component: SpaceDetailPage,
      props: true,
    },
    {
      path: '/picture/:id',
      name: '图片详情',
      component: PictureDetailPage,
      props: true,
    },
    {
      path: '/search_picture',
      name: '图片搜索',
      component: SearchPicturePage,
    },
    {
      path: '/about',
      name: 'about',
      // route level code-splitting
      // this generates a separate chunk (About.[hash].js) for this route
      // which is lazy-loaded when the route is visited.
      component: () => import('../views/AboutView.vue'),
    },

  ],
})

export default router
